home *** CD-ROM | disk | FTP | other *** search
Wrap
RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) NNNNaaaammmmeeee RWBTreeDictionary - Rogue Wave library class SSSSyyyynnnnooooppppssssiiiissss #include <rw/btrdict.h> RWBTreeDictionary a; DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn Dictionary class implemented as a B-tree, for the storage and retrieval of key-value pairs. Both the keys and values must inherit abstract base class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee -- the elements are ordered internally according to the value returned by virtual function ccccoooommmmppppaaaarrrreeeeTTTToooo(((()))) of the key (see class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee). Duplicate keys are not allowed. The B-tree is bbbbaaaallllaaaannnncccceeeedddd. That is, nodes are never allowed to have less than a certain number of items (called the oooorrrrddddeeeerrrr). The default order is 50, but may be changed by resetting the value of the static constant "oooorrrrddddeeeerrrr" in the header file <<<<bbbbttttrrrreeeeeeee....hhhh>>>> and recompiling. Larger values will result in shallower trees, but less efficient use of memory. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee Polymorphic PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss RWBTreeDictionary(); Constructs an empty B-tree dictionary. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss RWBoolean ooooppppeeeerrrraaaattttoooorrrr<<<<====(const RWBTreeDictionary& btr) const; Returns TTTTRRRRUUUUEEEE if self is a subset of bbbbttttrrrr. That is, for every item in self, there must be an item in bbbbttttrrrr that compares equal. This operator is not explicitly present unless you are compiling with an implementation of the C++ Standard Library. Normally it is inherited from RRRRWWWWBBBBTTTTrrrreeeeeeee. NNNNooootttteeee: If you inherit from RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy in the presence of the C++ Standard Library, we recommend that you override this operator and explicitly forward the call. Overload resolution in C++ will choose the Standard Library provided global operators over inherited class members. These PPPPaaaaggggeeee 1111 RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) global definitions are not appropriate for set-like partial orderings. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss void aaaappppppppllllyyyyTTTTooooKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWapplyKeyAndValue ap,void*); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Applies the user-supplied function pointed to by aaaapppp to each key-value pair of the collection, in order, from smallest to largest. RWBinaryTree aaaassssBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee(); RWBag aaaassssBBBBaaaagggg() const; RWSet aaaassssSSSSeeeetttt() const; RWOrdered aaaassssOOOOrrrrddddeeeerrrreeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const; RWBinaryTree aaaassssSSSSoooorrrrtttteeeeddddCCCCoooolllllllleeeeccccttttiiiioooonnnn() const: Converts the RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy to an RRRRWWWWBBBBaaaagggg, RRRRWWWWSSSSeeeetttt, RRRRWWWWOOOOrrrrddddeeeerrrreeeedddd, or an RRRRWWWWBBBBiiiinnnnaaaarrrryyyyTTTTrrrreeeeeeee. Note that since a dictionary contains pairs of keys and values, the result of this call will be a container holding RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnnssss. Note also that the return value is a ccccooooppppyyyy of the data. This can be very expensive for large collections. Consider using ooooppppeeeerrrraaaattttoooorrrr++++====(((()))) to insert each RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeeeAAAAssssssssoooocccciiiiaaaattttiiiioooonnnn from this dictionary into a collection of your choice. virtual RWspace bbbbiiiinnnnaaaarrrryyyySSSSttttoooorrrreeeeSSSSiiiizzzzeeee() const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual void cccclllleeeeaaaarrrr(); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes all key-value pairs from the collection. virtual void cccclllleeeeaaaarrrrAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes all key-value pairs in the collection, and deletes bbbbooootttthhhh the key and the value. PPPPaaaaggggeeee 2222 RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) virtual int ccccoooommmmppppaaaarrrreeeeTTTToooo(const RWCollectable* a) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. virtual RWBoolean ccccoooonnnnttttaaaaiiiinnnnssss(const RWCollectable* target) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual size_t eeeennnnttttrrrriiiieeeessss() const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual RWCollectable* ffffiiiinnnndddd(const RWCollectable* target) const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Returns the key in the collection which compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key is found. RWCollectable* ffffiiiinnnnddddKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable*& v) const; Returns the key in the collection which compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. The value is put in vvvv. You are responsible for defining vvvv before calling this function. RWCollectable* ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target) const; Returns the vvvvaaaalllluuuueeee associated with the key which compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. RWCollectable* ffffiiiinnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable* newValue); Returns the vvvvaaaalllluuuueeee associated with the key which compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt, or nnnniiiillll if no key was found. Replaces the value with nnnneeeewwwwVVVVaaaalllluuuueeee (if a key was found). PPPPaaaaggggeeee 3333 RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) virtual unsigned hhhhaaaasssshhhh() const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. unsigned hhhheeeeiiiigggghhhhtttt() const; Inherited from class RRRRWWWWBBBBTTTTrrrreeeeeeee. RWCollectable* iiiinnnnsssseeeerrrrttttKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(RWCollectable* key,RWCollectable* value); Adds a key-value pair to the collection and returns the key if successful, nnnniiiillll if the key is already in the collection. virtual RWClassID iiiissssAAAA() const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee to return ________RRRRWWWWBBBBTTTTRRRREEEEEEEEDDDDIIIICCCCTTTTIIIIOOOONNNNAAAARRRRYYYY. virtual RWBoolean iiiissssEEEEmmmmppppttttyyyy() const; Inherited from class RRRRWWWWBBBBTTTTrrrreeeeeeee. virtual RWBoolean iiiissssEEEEqqqquuuuaaaallll(const RWCollectable* a) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. virtual size_t ooooccccccccuuuurrrrrrrreeeennnncccceeeessssOOOOffff(const RWCollectable* target) const; Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Returns the number of keys that compare equal with ttttaaaarrrrggggeeeetttt. Because duplicates are not allowed, this function can only return 0 or 1. virtual RWCollectable* rrrreeeemmmmoooovvvveeee(const RWCollectable* target); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes the key and value pair for which the key compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt. Returns the key, or nnnniiiillll if no match was found. PPPPaaaaggggeeee 4444 RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) virtual void rrrreeeemmmmoooovvvveeeeAAAAnnnnddddDDDDeeeessssttttrrrrooooyyyy(const RWCollectable* target); Redefined from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. Removes aaaannnndddd deletes the key and value pair for which the key compares equal to the object pointed to by ttttaaaarrrrggggeeeetttt. Note that both the key and the value are deleted. Does nothing if the key is not found. RWCollectable* rrrreeeemmmmoooovvvveeeeKKKKeeeeyyyyAAAAnnnnddddVVVVaaaalllluuuueeee(const RWCollectable* target, RWCollectable*& v); Removes the key and value pair for which the key compares equal to the object pointed to by target. Returns the key, or nnnniiiillll if no match was found. The value is put in vvvv. You are responsible for defining vvvv before calling this function. virtual void rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWvistream&); virtual void rrrreeeessssttttoooorrrreeeeGGGGuuuuttttssss(RWFile&); virtual void ssssaaaavvvveeeeGGGGuuuuttttssss(RWvostream&) const; virtual void ssssaaaavvvveeeeGGGGuuuuttttssss(RWFile&) const; Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttiiiioooonnnn. virtual RWCollection* sssseeeelllleeeecccctttt(RWtestCollectable testfunc, void* x) const; Evaluates the function pointed to by ttttsssstttt for the key of each item in the RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy. It inserts keys and values for which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and returns a pointer to this new collection. Because the new dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done. This is not a virtual function. virtual RWCollection* sssseeeelllleeeecccctttt(RWtestCollectablePair testfunc, void* x) const; Evaluates the function pointed to by ttttsssstttt for both the key and the value of each item in the RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy. It inserts keys and values for which the function returns TTTTRRRRUUUUEEEE into a new RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy allocated off the heap and returns a pointer to this new collection. Because the new dictionary is allocated ooooffffffff tttthhhheeee hhhheeeeaaaapppp, you are responsible for deleting it when done. This is not a virtual function. PPPPaaaaggggeeee 5555 RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RRRRWWWWBBBBTTTTrrrreeeeeeeeDDDDiiiiccccttttiiiioooonnnnaaaarrrryyyy((((3333CCCC++++++++)))) RWStringID ssssttttrrrriiiinnnnggggIIIIDDDD(); (acts virtual) Inherited from class RRRRWWWWCCCCoooolllllllleeeeccccttttaaaabbbblllleeee. PPPPaaaaggggeeee 6666